#ifndef GOBANG_NETWORK_H
#define GOBANG_NETWORK_H

#include "Code/net/tcp.h"
#include "QObject"
#include "QWidget"
#include "QThread"

class Gobang_Network:public QThread
{
    Q_OBJECT
public:
    uint8_t link_state = 0;
    uint16_t tell_fd;
    uint16_t my_fd;
public:
    Gobang_Network();
    ~Gobang_Network(){
        delete t;
    }
public:
    uint8_t tellOpponent_chassxy(uint8_t x, uint8_t y, char color);
    uint8_t tellOpponent_string(char *str, uint8_t len);
    uint8_t tellOpponent_color(char color);
    uint8_t tellOpponent_data(uint8_t fun, uint8_t *data, uint8_t datalen);
    void tellOpponent_undo();
    void tellOpponent_undo_state(uint8_t yes_no);
public:
    tcp *t;
    void run();
};

#endif // GOBANG_NETWORK_H
